package com.bbg.amyam.web.flow.handler;

import javax.servlet.http.HttpServletRequest;

import org.springframework.webflow.context.servlet.DefaultFlowUrlHandler;
import org.springframework.webflow.core.collection.AttributeMap;

import com.bbg.amyam.web.mvc.exception.NoSchoolFoundException;
import com.bbg.amyam.web.util.RequestPathParameter;
import com.bbg.amyam.web.util.RequestPathPaser;

public class FlowURLHandler extends DefaultFlowUrlHandler  {

	@Override
	public String getFlowId(HttpServletRequest request) {
		String flowId = super.getFlowId(request);

		RequestPathParameter requestParam=null;
		try {
			requestParam = RequestPathPaser.parse(request);
		} catch (NoSchoolFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if(requestParam!=null && requestParam.getActionName()!=null){
			return requestParam.getViewName()+"/"+ requestParam.getActionName();
		}else{
			return null;
		}
	}

	


}
